

const request = new Promise(resolve => {
    setTimeout(() => {
        resolve('请求完成')
    },6000)
})
const request2 = new Promise((resolve1,reject1) => {
    setTimeout(() => {
        reject1('请求超时')
    }, 5000)
})

const task = (promises) => {

    return Promise.race(promises)
}
task([request,request2]).then(res => console.log(res), error => console.log(error))
